// Author: wsfuyibing <682805@qq.com>
// Date: 2025-06-12

package kind

// PayState
// 支付状态.
type PayState int

const (
	_ PayState = iota

	PayStateNot
	PayStatePaid
	PayStateRefunding
	PayStateRefunded
)

var (
	payStateTexts = map[PayState]string{
		PayStateNot:       "未付款",
		PayStatePaid:      "已付款",
		PayStateRefunding: "退款中",
		PayStateRefunded:  "已退款",
	}
	payStateUndefined = ""

	payStateFlags = map[PayState]string{
		PayStateNot:       "not",
		PayStatePaid:      "yes",
		PayStateRefunding: "refunding",
		PayStateRefunded:  "refunded",
	}
	payStateUnknownFlag = ""
)

func (o PayState) Flag() string {
	if str, ok := payStateFlags[o]; ok {
		return str
	}
	return payStateUnknownFlag
}

func (o PayState) IsNot() bool       { return o == PayStateNot }
func (o PayState) IsPaid() bool      { return o == PayStatePaid }
func (o PayState) IsRefunding() bool { return o == PayStateRefunding }
func (o PayState) IsRefunded() bool  { return o == PayStateRefunded }

func (o PayState) Text() string {
	if str, ok := payStateTexts[o]; ok {
		return str
	}
	return payStateUndefined
}
